package TeachLesson;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "updateteachLessonServlet")
public class updateteachLessonServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       String workerNo=request.getParameter("workerNo");
       String courseNo=request.getParameter("courseNo");
       String workerNoNew=request.getParameter("workerNoNew");

       TeachLessonsDao teachLessonsDao=new TeachLessonsDao();
       int row=teachLessonsDao.updateTeachLesson(workerNo,courseNo,workerNoNew);
       if(row>0){
           response.sendRedirect("techLessonServlet");
       }else {
           response.getWriter().println("修改出错,请后退重试");
       }
    }
}
